1. Field of the Invention
The present invention relates to an image processing device, an imaging device, an image processing method, and a program, and more particularly, to a multi-area white balance processing technique.
2. Description of the Related Art
Multi-area white balance processing (hereinafter, referred to as “multi-area WB processing”) is white balance processing (hereinafter, referred to as “WB processing”) that applies different white balance gains (hereinafter, referred to as “WB gains”) to each pixel or each area of one image. According to multi-area WB processing, even in an image of an object in which light components are emitted from a plurality of light sources to each pixel (each area) in different proportions, it is possible to accurately correct the color (color balance) of each pixel (each area).
For example, in a case in which flash light is emitted to capture a night portrait scene, an image of a person is captured while being affected by flash light (for example, light including a large amount of blue-wavelength light) and the background (night scene) of the captured image is not substantially affected by the flash light and is affected by other types of environmental light such as light from a sodium lamp (light including a large amount of red-wavelength light). In this case, it is necessary to apply a WB gain for cancelling the influence of flash light to the image of a person in order to obtain a good person image color (color balance) using WB processing. It is necessary to apply a WB gain for cancelling the influence of other types of environmental light to a background image in order to obtain a good background color (color balance). Therefore, in a case in which a common WB gain is applied to all of the pixels forming an image, it is difficult to obtain both a good person color (color balance) and a good background color (color balance).
However, according to multi-area WB processing, a WB gain applied to a person portion and a WB gain applied to a background portion in one image are changed. Therefore, for example, the WB gain applied to each pixel is optimized according to the degree of influence of flash light to obtain both a good person color (color balance) and a good background color (color balance).
JP2012-165077A discloses a white balance control device that can prevent a variation in a white balance control value which is calculated using color information obtained from an object region. The white balance control device detects the object region from an image, divides the image into a plurality of regions, calculates color information indicating the representative colors of regions that overlap the object region, and determines weights. Then, the white balance control device applies the weight determined for each region that overlaps the object region to each color information item, integrates the color information, and calculates a white balance control value at which the representative color becomes a target color from the integration result of the color information and information about a predetermined target color.
In some cases, image data and a WB gain are stored in order to adjust the white balance of an image after the image data is stored.
For example, an imaging device disclosed in JP2009-4895A stores accessory information required for a development process and RAW image data of a main image in a storage medium and can perform auto white balance adjustment when the development process is performed for the RAW image data.
In addition, an image processing device disclosed in JP2008-109505A applies a first white balance coefficient value for a first light source to RAW image data to generate intermediate RAW image data and stores information that can specify a second white balance coefficient value for light sources other than the first light source as white balance information so as to be associated with the intermediate RAW image data. In this way, it is possible to readjust a white balance.
An imaging device disclosed in JP2011-71708A performs a color reproduction process for a RAW image with a first color reproduction parameter that is applied during imaging to generate a developed image and associates data related to the first color reproduction parameter and data related to a second color reproduction parameter which corresponds to the color reproduction of an object under a light source different from the first color reproduction parameter with data of the developed image to generate an image file. Therefore, the first color reproduction parameter and the second color reproduction parameter can be applied to a case in which the developed image is retouched. For example, the first color reproduction parameter makes it possible to perform a process (reverse color reproduction process) that restores the developed image to the state before the color reproduction process and the second color reproduction parameter makes it possible to perform a color reproduction process for the image subjected to the reverse color reproduction process with the first color reproduction parameter.